package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.domain.SurveyProgrammeEntity;
import com.ly.heart.mapper.SurveyProgrammeMapper;
import com.ly.heart.service.ISurveyProgrammeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 勘测后的初步方案Service业务层处理
 *
 * @author wutao
 * @date 2024-05-22
 */
@Service
public class SurveyProgrammeServiceImpl extends ServiceImpl<SurveyProgrammeMapper, SurveyProgrammeEntity> implements ISurveyProgrammeService {

    @Resource
    private SurveyProgrammeMapper erpSurveyProgrammeInfoMapper;

    /**
     * 查询勘测后的初步方案
     *
     * @param id 勘测后的初步方案ID
     * @return 勘测后的初步方案
     */
    @Override
    public SurveyProgrammeEntity selectErpSurveyProgrammeInfoById ( String id ) {
        return erpSurveyProgrammeInfoMapper.selectErpSurveyProgrammeInfoById ( id );
    }

    /**
     * 查询勘测后的初步方案列表
     *
     * @param erpSurveyProgrammeInfo 勘测后的初步方案
     * @return 勘测后的初步方案
     */
    @Override
    public List<SurveyProgrammeEntity> selectErpSurveyProgrammeInfoList ( SurveyProgrammeEntity erpSurveyProgrammeInfo ) {
        return erpSurveyProgrammeInfoMapper.selectErpSurveyProgrammeInfoList ( erpSurveyProgrammeInfo );
    }

    /**
     * 新增勘测后的初步方案
     *
     * @param erpSurveyProgrammeInfo 勘测后的初步方案
     * @return 结果
     */
    @Override
    public int insertErpSurveyProgrammeInfo ( SurveyProgrammeEntity erpSurveyProgrammeInfo ) {
        erpSurveyProgrammeInfo.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        erpSurveyProgrammeInfo.setCreateTime ( DateUtils.getNowDate () );
        return erpSurveyProgrammeInfoMapper.insertErpSurveyProgrammeInfo ( erpSurveyProgrammeInfo );
    }

    /**
     * 修改勘测后的初步方案
     *
     * @param erpSurveyProgrammeInfo 勘测后的初步方案
     * @return 结果
     */
    @Override
    public int updateErpSurveyProgrammeInfo ( SurveyProgrammeEntity erpSurveyProgrammeInfo ) {
        erpSurveyProgrammeInfo.setChangeTime ( DateUtils.getNowDate () );
        return erpSurveyProgrammeInfoMapper.updateErpSurveyProgrammeInfo ( erpSurveyProgrammeInfo );
    }

    /**
     * 批量删除勘测后的初步方案
     *
     * @param ids 需要删除的勘测后的初步方案ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyProgrammeInfoByIds ( String[] ids ) {
        return erpSurveyProgrammeInfoMapper.deleteErpSurveyProgrammeInfoByIds ( ids );
    }

    /**
     * 删除勘测后的初步方案信息
     *
     * @param id 勘测后的初步方案ID
     * @return 结果
     */
    @Override
    public int deleteErpSurveyProgrammeInfoById ( String id ) {
        return erpSurveyProgrammeInfoMapper.deleteErpSurveyProgrammeInfoById ( id );
    }
}
